package com.ruoyi.system.ali;

import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayFundTransToaccountTransferRequest;
import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;

public class Tracn {
    private static  String appId="2021004120659646";
    private static String private_key="MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDYVmHbyhqp2S/JJpHKVXzuE5Duz7y7/1OBfG1oR1Z4UIbZTs8jPsdGuZM+mz9z3rX412buA3+PTZRsimn6Rm+LbmTMsQFtSSCwvfDg6zDRlgj9W9Q1DpTewZnBehvnBbeJDZJAgK1pWdei5K63SNk5N2bpuRuOgWFqgAtzsz4eZ57ddIffcZRhsZ81VrWDQaTH4YdCQIwUG0nXiFNL12SQeTQYslBuqCYOowG6eJUvK+3108o3Dyu+SFEh8Zm9wAzoetXxvpc1uNDByEO/wG7HOrb51hBeYFcKPFLBBBYRumndMHQAxsBVHCnfW6jMq1+5X70jg4TaHrRyc+2erGADAgMBAAECggEBAIJaYnKt760CGeIJZHVXV4SYs47CC4X3zhhKoh3gRkEOvII6E2O4UxjRfuCNaQlnW5yKJhIqd3UgmNth94N/Z3zLUt9nlGWGV7VHbdoIvQy8a8RFzbL+i0NBwmSrMB7e+f0R+Vr2bgb5xI35XzE/Kuxn7pHMIMeYO9uRNdVMXpSwXOSA1n9/EFQMu7aV32cNBYTiv61VtOVsLIIew79wA1V0a4V5oMuTtGXA27l2Lpcg53MQRVz/w2LYLEb1lIQgzlB81arMLcYUj1dWqRG0AScnNdT8uIyIpOoZtxhGXJj5S27p0+Lau2jIkBh/w0LGfeu2pWyMeSp5s6na/yl6GQkCgYEA/FtyKEogvYmUZO6bGaXsVPpJDIQRv8M0ljrOk0ylIMrJPZMqbooEqEMtpZ5FURozDcqN52A8UNkjyTIuKjuIvcfx30KHdWZ+TJ6wGFoQn5OqikwOxjJ0tRCqXCria5Amh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ZtV6I7lwmtvREEY5OidkY45+ogMxHpzIHaMIutyeWCt4oPw6+e5HBRr0AbVB6TJcQIDAQAB";
    public static void test() {
        String out_biz_no = System.currentTimeMillis() + "";
        AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", appId, private_key, "json", "GBK", alipay_public_key, "RSA2");
        AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest();
        JSONObject json = new JSONObject();
        json.put("out_biz_no", out_biz_no);
        json.put("payee_type", "ALIPAY_LOGONID");
        json.put("payee_account", "978689205@qq.com");
        json.put("amount", 0.1);
        json.put("payer_show_name", "码商");
        json.put("payee_real_name", "杨朋");
        json.put("remark", "码商转账");
        request.setBizContent(json.toJSONString());
        try {
            AlipayFundTransToaccountTransferResponse response = alipayClient.execute(request);
            System.out.println(JSONUtil.toJsonStr(response));
        } catch (Exception e) {

        }
    }

    public static void main(String[] args) {
        test();
    }
}
